package com.xysl.controller;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.xysl.api.model.XyslLoginUser;
import com.xysl.domain.dto.IntentionStuSaveDTO;
import com.xysl.domain.dto.QueryUserCustomizeDTO;
import com.xysl.domain.vo.GartenHomeDailyVo;
import com.xysl.domain.vo.IntentionStuVO;
import com.xysl.service.IntentionStuService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 意向学员 controller
 */
@Tag(name = "xysl_意向学员接口", description = "xysl_意向学员接口")
@RestController
@RequestMapping("/intentionStu")
public class IntentionStuController extends BaseController {

    @Resource
    private IntentionStuService intentionStuService;


    @Operation(summary = "意向学员列表")
    @PostMapping("/intentionStuList")
    public R<List<IntentionStuVO>> intentionStuList(
            @Parameter(description = "检索内容")
            @RequestParam(required = false) String searchValue) {
        XyslLoginUser xyslLoginUser = SecurityUtils.getXyslLoginUser();
        Long userId = xyslLoginUser.getXyslUser().getId();
        List<IntentionStuVO> res = intentionStuService.intentionStuList(userId);
        return R.ok(res);
    }


    @Operation(summary = "意向学员新增/修改")
    @PostMapping("/intentionStuSave")
    public R intentionStuSave(@RequestBody IntentionStuSaveDTO param) {
        XyslLoginUser xyslLoginUser = SecurityUtils.getXyslLoginUser();
        Long userId = xyslLoginUser.getXyslUser().getId();
        if (null != param.getId()) {
            param.setRegisterUserId(userId);
        }
        intentionStuService.intentionStuSave(param);
        return R.ok();
    }


}
